int inEMVStoreTCTrans(TRANSACTION_OBJECT *pobTran);
int inEMVClearTCFilesByHost(TRANSACTION_OBJECT *pobTran);
int inEMVClearTCFiles(TRANSACTION_OBJECT *pobTran);
int inEMVCreateTCRec(int inHostHandle, int inMerchHandle);
void vdEMVSetTCFileName(int inHostNum, int inMerchNum);
VS_BOOL fCheckLastTCRec(int inRecNum);
int inEMVCheckTCPending(void);
int inEMVGetTCRec(void);
int inEMVLoadTCHeader (void);
int inEMVSaveTCHeader (void);
int inEMVClearTCHeader(void);
int inEMVSaveTCRec (int inRecNum);
int inEMVLoadTCRec (int inRecNum);
int inEMVIncreaseTCRec(void);
int inEMVClearTCRec(void);
int inEMVSaveTCData(TRANSACTION_OBJECT *pobTran, int inRecNum);
void vdEMVLoadTCData(TRANSACTION_OBJECT *pobTran, int inRecNum);
int inEMVSendTCAdvice(TRANSACTION_OBJECT *pobTran, PACKET_OBJECT* pobPacket);
int inEMVCreateVariantStruct60(void);
int inEMVCreateVariantStruct63(void);
int inEMVResendTCUpload(TRANSACTION_OBJECT *pobTran , PACKET_OBJECT *pobPacket);
int inStoreTCEMVdata(TRANSACTION_OBJECT *pobTran, unsigned char *chTCData, unsigned short *pusLen);
int inBuildEMVTCData(TRANSACTION_OBJECT *pobTran,unsigned char *pbtBuff, unsigned short *pusLen);
void vdLoadEMVTCField55(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField35(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField37(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField38(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField39(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField60(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField23(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField22(TRANSACTION_OBJECT* pobTran);
void vdLoadEMVTCField03(TRANSACTION_OBJECT* pobTran);
int inTCIncSTAN(void);

extern void vdLoadCPACField04 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField14 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField22 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField24 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField37 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField39 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField41 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField42 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField48 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField54 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField60 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField61 (TRANSACTION_OBJECT *pobTran);
extern void vdLoadCPACField62 (TRANSACTION_OBJECT *pobTran);
extern void vdGetCPACMsgTypeId(BATCH_REC* psrBRec,unsigned char* pszData);
extern int inGetUCLCommLink(void);
extern long lnGetCPACBatchUploadSTAN(BATCH_REC* psrBRec);
extern void vdGetCPACMsgTypeId(BATCH_REC* psrBRec,unsigned char* pszData) ;

#define EMV_TC_FILENAME "TCR"
#define TC_FILE_EXTN   ".dat"

typedef struct TagTCHeader
{
	int inTCPending;
	int inRecNum;
	
} TC_HEADER;

typedef struct TagTCREC
{
		long lnInvNum;
		long lnTransactionAmount;	// Amount
		long lnStan;

		int inSizeField55;	
		char szTCProcCode[PROC_CODE_SIZE+1];
		char szMsgTypeId[MTI_SIZE + 1];
		char szDate[EXP_DATE_SIZE+1];
		char szTime[DATE_SIZE+1];
		char szExpDate[EXP_DATE_SIZE+1]; // Expired Date
		char szPAN[PAN_SIZE+1];        // PAN
		char szPOSEntry[POS_EM_SIZE+1];
		char szPANSeq[5];
		char stT2Data[TRACK2_SIZE +1]; // Track 2 Data              
		unsigned char	szRetRefNum[RET_REF_SIZE+1];
		char szAuthCode[AUTH_CODE_SIZE + 1];          
		char szRespCode[RESP_CODE_SIZE + 1];         
		char szTCField55[256+1];	
} TC_REC;
